package joe.works.commons.beans;

import joe.works.commons.IConvertor;

public class BeanToPropertyConvertor<BeanType, PropertyType> implements IConvertor<BeanType, PropertyType> {

	private String property;
	
	public void setProperty(String property) {
		this.property = property;
	}
	
	public PropertyType convert(BeanType obj) {
		BeanPropertyReader<BeanType, PropertyType> beanPropertyReader = new BeanPropertyReader<BeanType, PropertyType>();
		beanPropertyReader.setBean(obj);
		beanPropertyReader.setProperty(property);
		return beanPropertyReader.readProperty();
	}

}
